<script>
var x0=0,y0=0,x1=0,y1=0;
var offx=6,offy=6;
var moveable=false;
var hover='#114fc1',normal='#114fc1';//color;
var index=4;//z-index;
//开始拖动;
function startDrag(obj)
{
        if(event.button==1)
        {
                //锁定标题栏;
                obj.setCapture();
                //定义对象;
                var win = obj.parentNode;
                var sha = win.nextSibling;
                //记录鼠标和层位置;
                x0 = event.clientX;
                y0 = event.clientY;
                x1 = parseInt(win.style.left);
                y1 = parseInt(win.style.top);
                //记录颜色;
                normal = obj.style.backgroundColor;
                //改变风格;
                obj.style.backgroundColor = hover;
                win.style.borderColor = hover;
                obj.nextSibling.style.color = "#666666";
                sha.style.left = x1 + offx;
                sha.style.top  = y1 + offy;
                moveable = true;
        }
}
//拖动;
function drag(obj)
{
        if(moveable)
        {
                var win = obj.parentNode;
                var sha = win.nextSibling;
                win.style.left = x1 + event.clientX - x0;
                win.style.top  = y1 + event.clientY - y0;
                sha.style.left = parseInt(win.style.left) + offx;
                sha.style.top  = parseInt(win.style.top) + offy;
        }
}
//停止拖动;
function stopDrag(obj)
{
        if(moveable)
        {
                var win = obj.parentNode;
                var sha = win.nextSibling;
                var msg = obj.nextSibling;
                win.style.borderColor     = normal;
                obj.style.backgroundColor = normal;
                msg.style.color           = "#666666";
                sha.style.left = obj.parentNode.style.left;
                sha.style.top  = obj.parentNode.style.top;
                obj.releaseCapture();
                moveable = false;
        }
}
//获得焦点;
function getFocus(obj)
{
        if(obj.style.zIndex!=index)
        {
                index = index + 2;
                var idx = index;
                obj.style.zIndex=idx;
                obj.nextSibling.style.zIndex=idx-1;
        }
}
//最小化;
function min(obj)
{
        var win = obj.parentNode.parentNode;
        var sha = win.nextSibling;
        var tit = obj.parentNode;
        var msg = tit.nextSibling;
        var flg = msg.style.display=="none";
        if(flg)
        {
                win.style.height  = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*1;//改：2*2
                sha.style.height  = win.style.height;
                msg.style.display = "block";
                obj.innerHTML = "0";
        }
        else
        {
                win.style.height  = parseInt(tit.style.height) + 2*1;
                sha.style.height  = win.style.height;
                obj.innerHTML = "2";
                msg.style.display = "none";
        }
}
//关闭;
function cls(obj)
{
        var win = obj.parentNode.parentNode;
        var sha = win.nextSibling;
        win.style.visibility = "hidden";
        sha.style.visibility = "hidden";
}
//显示已经创建的对象
function viewObj(win)
{
        var sha = win.nextSibling;
        win.style.visibility = "visible";
        win.style.width   = 300;
        win.style.height  = 200;
        win.style.left    = 320;
        win.style.top     = 160;
        sha.style.visibility = "visible";
        sha.style.width   = 300;
        sha.style.height  = 200;
        sha.style.left    = 320;
        sha.style.top     = 160;
}
//隐藏已经创建的对象
function hideObj(win)
{
        var sha = win.nextSibling;
        win.style.visibility = "hidden";
        win.style.width   = 0;
        win.style.height  = 0;
        win.style.left    = 600;
        win.style.top     = 600;
        sha.style.visibility = "hidden";
        sha.style.width   = 0;
        sha.style.height  = 0;
        sha.style.left    = 600;
        sha.style.top     = 600;
}
//创建一个对象;
function xWin(id,w,h,l,t,tit,msg)
{
        index = index;
        this.id      = id;
        this.width   = w;
        this.height  = h;
        this.left    = l;
        this.top     = t;
        this.zIndex  = index;
        this.title   = tit;
        this.message = msg;
        this.obj     = null;
        this.bulid   = bulid;
        this.bulid();
}
//初始化;
function bulid()
{
        var str = ""
                + "<div id=xMsg" + this.id + " "
                + "style='"
                + "z-index:" + this.zIndex + ";"
                + "width:" + this.width + ";"
                + "height:" + this.height + ";"
                + "left:" + this.left + ";"
                + "top:" + this.top + ";"
                + "background-color:" + normal + ";"
                + "color:" + "#666666" + ";"
				//+ "class=font9;"
                + "font-size:9pt;"
                + "font-family:Arial;"
                + "position:absolute;"
                + "cursor:default;"
                + "border:1px solid " + normal + ";"
                + "' "
                + "onmousedown='getFocus(this)'>"
                        + "<div id='myChild' "
                        + "style='"
                        + "background-color:" + normal + ";"
                        + "width:" + (this.width-2*1) + ";"
                        + "height:18;"
                        + "color:#9fe4f8;"
                        + "' "
                        + "onmousedown='startDrag(this)' "
                        + "onmouseup='stopDrag(this)' "
                        + "onmousemove='drag(this)' "
                        + "ondblclick='min(this.childNodes[1])'"
                        + ">"
                                + "<span style='width:" + (this.width-2*12-4) + ";padding-left:2px;'>" + this.title + "</span>"
                                + "<span style='width:12;border-width:0px;color:#9fe4f8;font-family:webdings;' onclick='min(this)'>0</span>"
                                + "<span style='width:12;border-width:0px;color:#9fe4f8;font-family:webdings;' onclick='cls(this)'>r</span>"
                        + "</div>"
                                + "<div style='"
                                + "width:100%;"
                                + "height:" + (this.height-18-2) + ";"
                                + "background-color:#9fe4f8;"
                                + "line-height:16px;"
                                + "word-break:break-all;"
                                + "padding:1px;"
                                + "'>" + this.message + "</div>"
                + "</div>"
                + "<div style='"
                + "width:" + this.width + ";"
                + "height:" + this.height + ";"
                + "top:" + this.top + ";"
                + "left:" + this.left + ";"
                + "z-index:" + (this.zIndex-1) + ";"
                + "position:absolute;"
                + "background-color:#cccccc;"
                + "filter:alpha(opacity=40);"
                + "'>by wildwind</div>";
        document.body.insertAdjacentHTML("beforeEnd",str);
}
//查询赋值
function initialize(aa)
{
	if(form2.divStaus.value!="9")//当前页处于首页连接时禁止查询
	{
	if(form2.divStaus.value=="0"){
	<%if(voArray != null){%>
	var myMess="<table width=90% border=0 cellspacing=1 cellpadding=1 class=\\\"bg_table\\\">"
  +"<tr>"
  +"<td>"
  +"<table width=97% border=0 cellspacing=1 cellpadding=1 align=center class=\\\"bg_table\\\">"
  +"<form name=\"form4\" method=post action=\"/hotel/servlet/ControlServlet\" target=\"I2\">"
  +"<input type=\"hidden\" name=\"dotype\">"
  +"<input type=\"hidden\" name=\"workFldeId\" value=\"3\">"
  +"<input type=\"hidden\" name=\"sysElmId\" value=\"1\">"
  +"<input type=\"hidden\" name=\"querySjbm\" value=\"<%=voArray[0].getQuerytolSjbm()%>\">"
  +"<input type=\"hidden\" name=\"pageId\" value=\"<%=request.getParameter("sysElmId")%>\">"
 <%
for(int i = 0;i < voArray.length;i++){
     if(voArray[i].getQuerytolSig().equals("0")){
     out.println("+\"<tr width=\\\"100%\\\">\"");
     out.println("+\"<td>\"");
     out.println("+\"<input type=\\\"radio\\\" name=\\\"sig\\\" value=\\\""+new Integer(m).toString()+"\\\">\"");
     out.println("+\"</td>\"");
     out.println("+\"<td class=\\\"text\\\" width=\\\"50%\\\">\"");
     out.println("+\""+voArray[i].getQuerytolName()+"\"");
     out.println("+\"</td>\"");
     out.println("+\"<td width=\\\"50%\\\">\"");
     if(!voArray[i].getQuerytolType().equals("select")){
     out.print("+\"<input  type=\\\""+voArray[i].getQuerytolType()+"\\\" name=\\\""+voArray[i].getQuerytolPar()+"\\\"  ");
     if(voArray[i].getQuerytolDo()!=null){out.print(voArray[i].getQuerytolDo());}
     out.println(" onfocus=\\\"doFocus('"+new Integer(m).toString()+"')\\\" class=\\\"area100\\\">\"");
     }else{
     out.print("+\"<select name=\\\""+voArray[i].getQuerytolPar()+"\\\"  ");
     if(voArray[i].getQuerytolDo()!=null){out.print(voArray[i].getQuerytolDo());}
     out.println(" onfocus=\\\"doFocus('"+new Integer(m).toString()+"')\\\">\"");
     try{
     Class reflectClassJ2E=Class.forName(voArray[i].getQuerytolJ2e());
     Object myInst = reflectClassJ2E.newInstance();
     Method doJ2e = reflectClassJ2E.getMethod(voArray[i].getQuerytolJ2em(),null);
     Object[] myData = (Object[])doJ2e.invoke(myInst,null);
     for(int j=0;j<myData.length;j++){
                   Class reflectClassVO = myData[j].getClass();
                   Method getVO = reflectClassVO.getMethod(voArray[i].getQuerytolVo(),null);
                   Method getVOm = reflectClassVO.getMethod(voArray[i].getQuerytolVom(),null);
     out.println("+\"<option value=\\\""+getVO.invoke(myData[j],null).toString()+"\\\">"+getVOm.invoke(myData[j],null).toString()+"</option>\"");
             }
     }
             catch (IllegalAccessException ex) {
               ex.printStackTrace();
             }catch (IllegalArgumentException ex) {
               ex.printStackTrace();
             }catch (InvocationTargetException ex) {
               ex.printStackTrace();
             }catch (NoSuchMethodException ex) {
               ex.printStackTrace();
             }catch (SecurityException ex) {
               ex.printStackTrace();
             }
     out.println("+\"</select>\"");
     }
     out.println("+\"</td>\"");
     out.println("+\"</tr>\"");
     m = m + 1;}else k = k + 1;}
     if(m < voArray.length){
     out.println("+\"<tr>\"");
     out.println("+\"<td>\"");
     out.println("+\"<input type=\\\"radio\\\" name=\\\"sig\\\" value=\\\""+new Integer(m).toString()+"\\\">\"");
     out.println("+\"</td>\"");
     out.println("+\"<td colspan=\\\"2\\\" class=\\\"text\\\" style=\\\"width:95%\\\">组合查询</td>\"");
     out.println("+\"</tr>\"");
     out.println("+\"<tr>\"");
     out.println("+\"<td>&nbsp;</td>\"");
     out.println("+\"<td colspan=\\\"2\\\">\"");
     out.println("+\"<table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"1\\\" cellpadding=\\\"1\\\" align=\\\"center\\\" class=\\\"text\\\">\"");
     for(int i = 0;i < voArray.length;i++){
     if(voArray[i].getQuerytolSig().equals("1")){
     out.println("+\"<tr>\"");
     out.println("+\"<td>\"");
     out.println("+\""+voArray[i].getQuerytolName()+"\"");
     out.println("+\"</td>\"");
     out.println("+\"<td style=\\\"width:50%\\\">\"");
     if(!voArray[i].getQuerytolType().equals("select")){
     out.print("+\"<input type=\\\""+voArray[i].getQuerytolType()+"\\\" name=\\\""+voArray[i].getQuerytolPar()+"\\\"  ");
     if(voArray[i].getQuerytolDo()!=null){out.print(voArray[i].getQuerytolDo());}
     out.println(" onfocus=\\\"doFocus('"+new Integer(m).toString()+"')\\\" class=\\\"area100\\\">\"");
     }else{
     out.print("+\"<select name=\\\""+voArray[i].getQuerytolPar()+"\\\"  ");
     if(voArray[i].getQuerytolDo()!=null){out.print(voArray[i].getQuerytolDo());}
     out.println(" onfocus=\\\"doFocus('"+new Integer(m).toString()+"')\\\">\"");
     try{
     Class reflectClass=Class.forName(voArray[i].getQuerytolJ2e());
     Object myInst = reflectClass.newInstance();
     Method doJ2e = reflectClass.getMethod(voArray[i].getQuerytolJ2em(),null);
     Object[] myData = (Object[])doJ2e.invoke(myInst,null);
     for(int j=0;j<myData.length;j++){
                   Class reflectClassVO = myData[j].getClass();
                   Method getVO = reflectClassVO.getMethod(voArray[i].getQuerytolVo(),null);
                   Method getVOm = reflectClassVO.getMethod(voArray[i].getQuerytolVom(),null);
     out.println("+\"<option value=\\\""+getVO.invoke(myData[j],null).toString()+"\\\">"+getVOm.invoke(myData[j],null).toString()+"</option>\"");
             }
     }
             catch (IllegalAccessException ex) {
               ex.printStackTrace();
             }catch (IllegalArgumentException ex) {
               ex.printStackTrace();
             }catch (InvocationTargetException ex) {
               ex.printStackTrace();
             }catch (NoSuchMethodException ex) {
               ex.printStackTrace();
             }catch (SecurityException ex) {
               ex.printStackTrace();
             }
     out.println("+\"</select>\"");
     }
     out.println("+\"</td>\"");
     out.println("+\"</tr>\"");
     }
     }
     out.println("+\"</table>\"");
     out.println("+\"</td>\"");
     out.println("+\"</tr>\"");
     }
     out.println("+\"<tr>\"");
     out.println("+\"<td colspan=\\\"3\\\" align=\\\"center\\\">\"");
     out.println("+\"<p>&nbsp;</p>\"");
     if(m < voArray.length)
     out.println("+\"<input type=\\\"hidden\\\" name=\\\"total\\\" value=\\\""+new Integer(m).toString()+"\\\">\"");
     else out.println("+\"<input type=\\\"hidden\\\" name=\\\"total\\\" value=\\\""+new Integer(m-1).toString()+"\\\">\"");
     out.println("+\"<input type=\\\"hidden\\\" name=\\\"muil\\\" value=\\\""+new Integer(k).toString()+"\\\">\"");
     out.println("+\"<input type=\\\"button\\\"  class=\\\"area100\\\" name=\\\"bt\\\" value=\\\"全部\\\" onclick=\\\"doAll('queryall','\"+aa+\"')\\\" >\"");
     out.print("+\"&nbsp;\"");
     out.println("+\"<input type=\\\"button\\\" class=\\\"area100\\\"  name=\\\"bt1\\\" value=\\\"提交\\\" onclick=\\\"doAll('querypart','\"+aa+\"')\\\" >\"");
     out.println("+\"</td>\"");
     out.println("+\"</tr>\"");
     out.println("+\"</form>\"");
     out.println("+\"</table>\"");
     out.println("+\"</td>\"");
     out.println("+\"</tr>\"");
     out.println("+\"</table>\"");%>;
<%}else{%>
	var myMess = "本模块的不采用此种查询方式，请使用页面中的查询或点击列表！";
<%}%>
var b = new xWin("2",300,200,320,160,"<font class=font9>查询</font>",myMess);
form2.divStaus.value=1;
	}else{
		viewObj(xMsg2);
	}
	}
	else
	{
		alert("现在的页面状态不允许使用该按钮！");
	}
}
</script>